package gov.police.diary.controller;

import gov.police.diary.command.SearchCommand;
import java.util.Map;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.portlet.bind.annotation.ActionMapping;
import org.springframework.web.portlet.bind.annotation.RenderMapping;

@Controller
@RequestMapping("VIEW")
public class DepartmentController extends AbstractSearchController {

    @Override
    protected Object[] getResult(String keywords, long start, long end) {
        return new Object[0];
    }

    @Override
    protected long getResultTotal(String keywords) {
        return 0;
    }

    @Override
    @RenderMapping(params="action=viewDepertment")
    public String render(RenderRequest request, RenderResponse response, SearchCommand command, Model model) {
        return super.render(request, response, command, model);
    }

    @Override
    @ActionMapping(params="action=searchDepartment")
    public void search(ActionRequest request, ActionResponse response, SearchCommand command, Model model) {
        super.search(request, response, command, model);
        response.setRenderParameter("action", "viewDepertment");
    }

    @Override
    protected String createPageHeader() {
        return  "Phong/Ban";
    }

    @Override
    protected String createSearchAction() {
        return "searchDepartment";
    }

    @Override
    protected Map<String, String> createOtherActions() {
        return null;
    }

}
